package com.example.java_chatroom.service;

import com.example.java_chatroom.mapper.MessageMapper;
import com.example.java_chatroom.model.Message;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageService {
    @Resource
    private MessageMapper messageMapper;

    public String getLastMessageBySessionId(int sessionId){
        return  messageMapper.getLastMessageBySessionId(sessionId);
    }

    public List<Message> getMessageBySessionId(int sessionId){
        return messageMapper.getMessageBySessionId(sessionId);
    }

    public void add(Message message){
        messageMapper.add(message);
    }
}
